package enum

import "micro-oauth/datamodels/autherror"

type ClientType string

const (
	WebClient ClientType = "WEB"
	PosClient ClientType = "POS"
	PDAClient ClientType = "PDA"
)

type MethodType string

const (
	GET    MethodType = "GET"
	POST   MethodType = "POST"
	PUT    MethodType = "PUT"
	DELETE MethodType = "DELETE"
)

type UserType string

const (
	UserType_Staff         UserType = "STAFF"
	UserType_Pos           UserType = "POS"
	UserType_VendorUser    UserType = "VENDOR_USER"
	UserType_VendorManager UserType = "VENDOR_MANAGER"
)

type UserStatus string

const (
	UserStatus_Active    UserStatus = "ACTIVE"
	UserStatus_Forbidden UserStatus = "FORBIDDEN"
	UserStatus_Deleted 	 UserStatus = "DELETED"
)

type DeviceStatus string

const (
	DeviceStatus_Init      DeviceStatus = "INIT"
	DeviceStatus_Active    DeviceStatus = "ACTIVE"
	DeviceStatus_Forbidden DeviceStatus = "FORBIDDEN"
)

type ErrorCode string

const (
	 LoginWrongPasswordError ErrorCode  = "LoginWrongPasswordError" //输入错误密码次数达到上限 请十分钟后再试
	 UserLockedError  ErrorCode = "UserLockedError" //当前用户正在被锁定中
	 PassWordExpireError ErrorCode = "PassWordExpireError" //密码长时间未修改,系统已为您重新生成随机密码,并发送到您的邮箱
	 PassWordNotFitRule  ErrorCode = "PassWordNotFitRule" // 当前的密码不符合管理员设置的密码规则
)

type BindStatus string

const (
	Binded BindStatus = `BINDED`
	UnBinded BindStatus = `UNBINDED`
)

var (
	statusMap  = map[BindStatus]bool{
		Binded:true,
		UnBinded:true,
	}
)

func (status BindStatus)Valid()autherror.HexError  {
	_,ok := statusMap[status];if !ok{
		return autherror.InvalidData(`bind_status only in (BINDED,UNBINDED)`)
	}

	return nil
}
